package com.zr.serviceimpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.ShoScopDao;
import com.zr.model.Cdisstation;
import com.zr.service.ShoScopService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Service("shoscopserviceimpl")
public class ShoScopServiceImpl implements ShoScopService{
   @Resource
	private ShoScopDao shoscopdao;
	@Override
	public JSONObject getStation(String uname) {
		JSONObject jo=new JSONObject();
		JSONArray ja=new JSONArray();
		List <Cdisstation>li=shoscopdao.findStation(uname);
		for (Cdisstation cdisstation : li) {
			JSONObject j=new JSONObject();
			j.put("disid", cdisstation.getDisid());
			j.put("disname", cdisstation.getDisname());

			j.put("distypeid", cdisstation.getCstationtype().getDistype());

			j.put("cuser", cdisstation.getCuser().getUname());
			j.put("disscope", cdisstation.getDisscope());
			j.put("disprice", cdisstation.getDisprice());
			j.put("instation", cdisstation.getInstation());
			ja.add(j);
		}
		jo.put("rows", ja);
		
		return jo;
	}

}
